import Vue from "vue";
import VueRouter from "vue-router";
import discover from "@/pages/discover";
import friend from "@/pages/friend";
// import mine from "@/pages/mine"

//将vuerouter注入到所有vue子组件

Vue.use(VueRouter);
// 配置路由的三个步骤
// 1.创建页面组件
// 2.配置routes，一个数组，数组中每个对象基本属性path，component
// 3.将router-view路由试图组件放在正确的位置

//路由配置routers

let routes = [
  {
    path: "/discover",
    component: discover,
  },
  {
    path: "/friend",
    component: friend,
  },
  {
    path: "/mine/:id",
    component: /*webpackChunkName:"mine"*/ () => import("@/pages/mine"),
  },
  {
    path: "/list",
    component: () => import("@/pages/list"),
  },
  {
    path: "/detail/:productid",
    component: () => import("@/pages/detail"),
  },
  {
    path: "*",
    component: () => import("@/pages/page404"),
  },
];

//实例化vue路由

let router = new VueRouter({
  routes,
});

export default router;
